import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_base/common/colors.dart';
import 'package:flutter_base/common/images.dart';
import 'package:flutter_base/widgets/base/basePage.dart';
import 'package:flutter_base/widgets/commonWidgets.dart';

/// Create： Zhang 3/22/21 1:48 PM
/// 描述：加载本地图标

class LoadImagePage extends BasePage {
  LoadImagePage() : super(title: "图片加载");

  @override
  PageState createState() => Content();
}

class Content extends PageState {
  //列表
  List<Widget> getItems() {
    List<Widget> items = [];
    for (int i = 0; i < 10; i++) {
      items.add(commonItem("Item$i", onClick: () {}));
    }
    return items;
  }

  @override
  Widget? rootView(BuildContext context) {
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.light,
      child: Container(
        width: double.infinity,
        height: double.infinity,
        color: bgColor,
        child: Stack(
          children: [
            Column(
              children: [
                assetImage(CustomImage.news),
                Expanded(
                  child: SingleChildScrollView(
                    child: Column(
                      children: getItems(),
                    ),
                  ),
                ),
              ],
            ),
            Container(
              padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
              child: Stack(
                alignment: AlignmentDirectional.centerStart,
                children: [
                  Container(
                    alignment: Alignment.center,
                    height: 56,
                    child: Text(
                      widget.title,
                      style: TextStyle(color: Colors.white, fontSize: 18),
                    ),
                  ),
                  IconButton(
                    icon: Icon(Icons.arrow_back, color: Colors.white),
                    onPressed: () {
                      Navigator.pop(context);
                    },
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
